using System;
using System.Xml.Serialization;

namespace Communication
{
    /// <summary>
    /// Represents a short message read from the phone in undecoded PDU format.
    /// </summary>
    [Serializable]
    public class ShortMessageFromPhone : ShortMessage
    {
        private int _index;
        private int _status;

        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ShortMessageFromPhone()
        {
            _index = 0;
            _status = 0;
        }

        /// <summary>
        /// Initializes a new instance of the ShortMessageFromPhone class.
        /// </summary>
        /// <param name="index">The index where the message is saved in the device in the currently active storage.</param>
        /// <param name="status">The message status (e.g. read or unread)</param>
        /// <param name="alpha">The alphabet in which the message is encoded.</param>
        /// <param name="length">The length of the data.</param>
        /// <param name="data">The actual message.</param>
        /// <remarks>The object contains all data returned by the phone.
        /// </remarks>
        public ShortMessageFromPhone(int index, int status, string alpha, int length, string data) : base(alpha, length, data)
        {
            Index = index;
            Status = status;
        }

        /// <summary>
        /// The index of the message.
        /// </summary>
        [XmlAttribute]
        public int Index
        {
            get { return _index; }
            set { _index = value; }
        }

        /// <summary>
        /// The message status (e.g. read, unread, etc.)
        /// </summary>
        [XmlAttribute]
        public int Status
        {
            get { return _status; }
            set { _status = value; }
        }
    }
}